package com.pangu.interfaces.proxy;

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;

/**
 * @author Linbizhao
 * @description: 盘古降级对象工厂
 * @since 2023/11/17
 */
@Slf4j
public abstract class BaseFallbackFactory<T> {

    public T createFallbackFactory(Throwable throwable, Class<T> tClass) {
        if (throwable != null && StringUtils.isNotEmpty(throwable.getMessage())) {
            log.error(throwable.getMessage(), throwable);
        }
        return new FallbackProxyCreator<T>().getProxy(tClass);
    }

}
